package p1;

public class P1T02 {
    public static void main(String[] args) throws Exception {
        Person p1;
        p1 = new Person();
        p1.setName("张三");
        Student s1=new Student();
        s1.setNo("11111");
        s1.setName("Jonny");
    }
}
class Person{
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private String name;
}
class Student extends Person{
    private String no;

    public String getNo() {
        return no;
    }

    public void setNo(String no) throws Exception {
        if(no.length()!=11)throw new Exception("学号必须是11位");
        this.no = no;
    }
}